package preprocess;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class CollegeMapper extends Mapper<LongWritable, Text,Text, IntWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String[] words = line.split(" ");
        int num = Integer.parseInt(words[7]);
        context.write(new Text(words[0] + ' ' + words[1] + ' ' +
                words[2] + ' ' + words[3] + ' ' + words[4] + ' ' + words[5] + ' ' +
                words[6]), new IntWritable(num));
    }
}
